<?php



namespace backend\modules\wechat\controllers;



use backend\controllers\AdminController;
use Yii;
class BaseReplyController extends AdminController
{


    //保存规则和关键字
    public static function dataSave($rule,$keyword,$type='text')
    {
        $rule->setAttributes(['wid'=>1,'module'=>'system','processor'=>$type]);
        if ($rule->load(Yii::$app->request->post()) && $rule->save()) {
            $keyword->setAttributes(['module'=>'system','wid'=>1,'rid'=>$rule->attributes['id'],'status'=>1]);
            if($keyword->load(Yii::$app->request->post()) && $keyword->save()){
                return $rule;
            }
        }
        return false;
    }

}